package utils

import (
	"fmt"
	"math/rand"
	"strings"
	"time"
)

func GenerateSmsCode(witdh int) string {
//生成width长度的短信验证码

numeric := [10]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
r := len(numeric)
rand.Seed(time.Now().UnixNano())

var sb strings.Builder
for i := 0; i < witdh; i++ {
fmt.Fprintf(&sb, "%d", numeric[rand.Intn(r)])
}
return sb.String()
}

